Ajax = {
    sendAjax: function(url,data,method,successFunction,beforeFunction,afterFunction){
        if(data==undefined) data='data='+url;
        if(method==undefined) method='post';

        $.ajax({
            url: url,
            type: method,
            data: data,
            dataType: 'json',
            beforeSend: function(){
                if(beforeFunction!=undefined) beforeFunction();
            },
            complete: function(){
                if(afterFunction!=undefined) afterFunction();
            },
            success: function(json){
                if(successFunction!=undefined) successFunction(json);
            }
        });
    }
}